import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-search',
  templateUrl: './search.component.html',
  styleUrls: ['./search.component.scss']
})
export class SearchComponent implements OnInit {

  public keyWords:string="";

  public wordsList:any[]=[];


  constructor() { }

  ngOnInit(): void {
  }


  doSearch(){
    let word1=0;
    for (let word of this.wordsList){
      if(this.keyWords==word){
        word1=1;
      }
      else
        word1=0;
      
    }

    word1==1||this.keyWords==''? this.keyWords='':this.wordsList.push(this.keyWords); 
    console.log(this.wordsList)

    this.keyWords='';
  }

  doDelete(key:any){
    this.wordsList.splice(key,1);
  }

}
